﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HA.ModFlow.Domain.FileLayer
{
    public class PPreconditionedConjugateGradient : Package
    {
        public PPreconditionedConjugateGradient()
        {
            this._fileType = FileType.PCG;
            this.Fname = "solution.pcg";

            this.Nunit = 32;


        }


        int _MXITER;

        public int MXITER
        {
            get { return _MXITER; }
            set { _MXITER = value; }
        }

        int _ITER1;


        /// <summary>
        /// 取值范围为 10-30
        /// </summary>
        public int ITER1
        {
            get { return _ITER1; }
            set { _ITER1 = value; }
        }


        int _CPCOND;

        public int CPCOND
        {
            get { return _CPCOND; }
            set { _CPCOND = value; }
        }


        double _HCLOSE;

        public double HCLOSE
        {
            get { return _HCLOSE; }
            set { _HCLOSE = value; }
        }

        double _RCLOSE;

        public double RCLOSE
        {
            get { return _RCLOSE; }
            set { _RCLOSE = value; }
        }


        double _RELAX;

        public double RELAX
        {
            get { return _RELAX; }
            set { _RELAX = value; }
        }

        int _NBPOL;

        public int NBPOL
        {
            get { return _NBPOL; }
            set { _NBPOL = value; }
        }

        int _IPRPCG;

        public int IPRPCG
        {
            get { return _IPRPCG; }
            set { _IPRPCG = value; }
        }

        int _MUTPCG;

        public int MUTPCG
        {
            get { return _MUTPCG; }
            set { _MUTPCG = value; }
        }

        double _DAMP;

        /// <summary>
        /// 取值范围 0-1；1表示不damp
        /// </summary>
        public double DAMP
        {
            get { return _DAMP; }
            set { _DAMP = value; }
        }


        public override void WriteFile(string path)
        {
            string content = "";
            content = "# HuanAnKeJi PCG File" + "\r\n";
            content += this.MXITER + "  " + this.ITER1 + "  " + this.CPCOND + "                             Item 1:  MXITER ITER1 NPCOND" + "\r\n"; 
            content += this.HCLOSE + "  " + this.RCLOSE + "  " + this.RELAX + "  " + this.NBPOL + "  " + this.IPRPCG + "  " + this.MUTPCG + "  " + this.DAMP + "    Item 2:  HCLOSE RCLOSE RELAX NBPOL IPRPCG MUTPCG DAMP";
            string fname = path + this.Fname;
            HAUtil.FileOperations.WriteFile(fname, content);
        }


    }
}
